<?php

namespace mbilling\BillingBundle\Model;

use Doctrine\ORM\EntityManager;
use mbilling\BillingBundle\Entity\usersBillsSources;


Class UsersBillsSourcesModel
{
    protected $em;

    public function __construct(EntityManager $em)
    {
        $this->em = $em;
    }
    
    public function findAll()
    {
        $sources = $this->em->getRepository('BillingBundle:usersBillsSources')->findAll();
        return $sources;
    }

    public function findByPK($source_id)
    {
        $source = $this->em->find('BillingBundle:usersBillsSources', $source_id);
        return $source;
    }
    
    public function create($oEntity)
    {
        $this->em->persist($oEntity);
        $this->em->flush();
    }
    
    public function removeByPK($source_id)
    {
        $source = $this->em->find('BillingBundle:usersBillsSources', $source_id);
        $this->em->remove($source);
        $this->em->flush();
    }
}
?>
